package com.action
{
	import com.stage.item.BasePlayer;
	import com.stage.item.Player;
	
	public class ActionMove extends BaseAction
	{
		private var _speed:Number;
		
		public function ActionMove(player:Player, speed:Number)
		{
			super(player);
			_speed = speed;
		}
		
		public override function start(dir:int=1):void{
			_dir = dir;
			_player.walkDir(dir, _speed);
		}
		
		public function set speed(value:Number):void{
			if(_speed != value){
				_speed = value;
				if(_dir != BasePlayer.WALK_DIR_NONE){
					_player.walkDir(_dir, _speed);
				}
			}
		}
		
		public function set dir(value:int):void{
			if(_dir != value){
				_dir = value;
				if(_dir != BasePlayer.WALK_DIR_NONE){
					_player.walkDir(_dir, _speed);
				}
			}
		}
		
		public override function end():void{
			_player.walkStop();
		}
	}
}